Auto merge of #4378 - behnam:ignore, r=alexcrichton
authorbors <bors@rust-lang.org>
Wed, 9 Aug 2017 14:33:51 +0000 (14:33 +0000)
committerbors <bors@rust-lang.org>
Wed, 9 Aug 2017 14:33:51 +0000 (14:33 +0000)
commit9d161a2f9c1b69f7188f2d3f5e83c21ef0e9bf04
tree13dc4c22e5c7a8e51d3397afa93343f6b43e9c76
parentd2e8587dc459d79045675ce721c3ef06220d7c67
parent5641cbde4b21fc4c2e39d484448f0d35b3ca4bc0
Auto merge of #4378 - behnam:ignore, r=alexcrichton

[sources/path] Support leading slash in glob patterns

Background: https://github.com/rust-lang/cargo/issues/4268

This diff takes us to **Stage 1.1** of the migration plan by allowing
glob patterns to include a leading slash, so that glob patterns can be
updated, if needed, to start with a slash, closer to the future behavior
with gitignore-like matching.

Why is this stage needed?

It's common to have `package.include` set like this:
```
include = ["src/**"]
```
In old interpretation, this would only include all files under the `src`
directory under the package root. With the new interpretation, this
would match any path with some directory called `src`, even if it's not
directly under the package root.

After this patch, package owners can start marking glob patters with a
leading slash to fix the warning thrown, if any.

One thing to notice here is that there are no extra matchings, but, if
a manifest has already a pattern with a leading slash, this would
silently start matching it with the paths. I believe this is fine, since
the old behavior would have been for the pattern to not match anything,
therefore the item was useless.

See also <https://github.com/rust-lang/cargo/issues/4377> for suggestion
to throw warning on useless/invalid patterns in these fields.